package jsp;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author 黄衡熙
 * @version 1.0
 */
public class ApplicationServlet extends HttpServlet {
    protected void service(HttpServletRequest req, HttpServletResponse resp)throws ServletException, IOException{
//        在servlet中，可以直接获取到ServletContext
        ServletConfig application=getServletConfig();
        String name=application.getInitParameter("name");
        System.out.println("全局初始化参数name的值为:"+name);
    }
}
